//Name: Sara Thorup
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"
void test();
/*

Unit tests for sea hag card
Sea hag allows discards every other player's top deck card and replaces it with a curse card

Things to test:
- net deck count should be the same
- top deck card should be curse card
- discard count should increase
- top discard card should be discarded card
*/

int main(int argc, char *argv[]) {
	printf("\n ===== Testing Sea hag card =====\n");
	test();
	return 0;
}

void test(int choice) {
	//setup
	struct gameState* gameState = newGame();
	
	int testPlayer = 0;
	int otherTestPlayer = 1;
	int numPlayers = 2;
	int kingdomCards[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
	int randomSeed = 10;
	if (initializeGame(numPlayers, kingdomCards, randomSeed, gameState) != 0){
		printf("Error initalizing game. \n");
		return;
	}
	gameState->whoseTurn = testPlayer;
	int choice1 = 0;
	int choice2 = 0;
	int choice3 = 0;
	int handPos = 0;
	int bonus = 0;



	int initalDeckCount = 15;  //set default deck count
	int initalDiscardCount = 15; //set discard count
	gameState->deckCount[otherTestPlayer] = initalDeckCount;
	gameState->discardCount[otherTestPlayer] = initalDiscardCount;

	int i = 0;
	for (; i < initalDeckCount; i++) {
		gameState->deck[otherTestPlayer][i] = estate;
	}
	gameState->discardCount[otherTestPlayer] = initalDiscardCount;

	for (i = 0; i < initalDiscardCount; i++) {
		gameState->discard[otherTestPlayer][i] = gold;
	}

	cardEffect(sea_hag, choice1, choice2, choice3, gameState, handPos, &bonus);
	int newDeckCount = gameState->deckCount[otherTestPlayer];
	int newDiscardCount = gameState->deckCount[otherTestPlayer];
	if (newDeckCount == initalDeckCount - 1) {
		printf("Sea_hag Card: PASS number net cards in deck the same  \n"  );
	} else {
		printf("Sea_hag Card: FAIL number net cards in deck not the same  \n"  );
	}

	if(gameState->deck[otherTestPlayer][newDeckCount - 1] == curse) {
		printf("Sea_hag Card: PASS curse card on top of deck \n"  );
	} else {
		printf("Sea_hag Card: FAIL curse card not on top of deck \n"  );
	}

	if (newDiscardCount == initalDiscardCount + 1) {
		printf("Sea_hag Card: PASS number cards in discard incremented \n"  );
	} else {
		printf("Sea_hag Card: FAIL number cards in discard not incremented \n"  );
	}

	if(gameState->discard[otherTestPlayer][newDiscardCount - 1] == estate) {
		printf("Sea_hag Card: PASS card has been discarded \n"  );
	} else {
		printf("Sea_hag Card: FAIL card not discarded \n"  );
	}

}